package com.lagou.id;

import org.apache.shardingsphere.core.strategy.keygen.SnowflakeShardingKeyGenerator;
import org.apache.shardingsphere.spi.keygen.ShardingKeyGenerator;

import java.util.Properties;

/**
 * @author lyj
 * @Title: MyLagouId
 * @ProjectName mysql-example
 * @Description: TODO
 * @date 2021/1/10 22:37
 */

public class MyLagouId  implements ShardingKeyGenerator {
    private SnowflakeShardingKeyGenerator snow=new SnowflakeShardingKeyGenerator();
    @Override
    public Comparable<?> generateKey() {
        System.out.println("-----执行了自定义主键生成器----");
        return snow.generateKey();
    }

    @Override
    public String getType() {
        return "LAGOUKEY";
    }

    @Override
    public Properties getProperties() {
        return null;
    }

    @Override
    public void setProperties(Properties properties) {

    }
}
